#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve()
{
    int n;
    cin >> n;

    if (n == 1)
        cout << 1 << endl;
    else if (n == 2)
        cout << "1 2" << endl;
    else if (n == 3)
        cout << "2 1 3" << endl;
    else
    {
        int i = 4;
        cout << 2 << ' ';
        while (i <= 3 + (n - 3) / 2)
        {
            cout << i << ' ';
            i++;
        }
        cout << 1 << ' ';
        while (i <= n)
        {
            cout << i << ' ';
            i++;
        }
        cout << 3 << endl;
    }
}
int main()
{
    int t = 0;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
